package org.framework.edge.builder.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.wu.framework.web.spring.EasyController;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.response.ResultFactory;
import org.springframework.beans.factory.annotation.Autowired;
import jakarta.annotation.Resource;
import java.util.List;
import org.framework.edge.builder.domain.model.docker.images.DockerImages;
import org.framework.edge.builder.application.command.docker.images.DockerImagesRemoveCommand;
import org.framework.edge.builder.application.command.docker.images.DockerImagesStoryCommand;
import org.framework.edge.builder.application.command.docker.images.DockerImagesUpdateCommand;
import org.framework.edge.builder.application.command.docker.images.DockerImagesQueryListCommand;
import org.framework.edge.builder.application.command.docker.images.DockerImagesQueryOneCommand;
import org.framework.edge.builder.application.DockerImagesApplication;
import org.framework.edge.builder.application.dto.DockerImagesDTO;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.framework.edge.builder.application.command.docker.images.DockerImagesExcelExport;
import org.framework.edge.builder.application.command.docker.images.DockerImagesExcelImport;
import org.wu.framework.easy.excel.stereotype.RequestExcelBody;
import org.wu.framework.easy.excel.stereotype.EasyExcel;
/**
 * describe docker镜像 
 *
 * @author Jia wei Wu
 * @date 2025/07/10 05:16 下午
 * @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController 
 **/
@Tag(name = "docker镜像提供者")
@EasyController("/docker/images")
public class DockerImagesProvider  {

    @Resource
    private DockerImagesApplication dockerImagesApplication;

    /**
     * describe 新增docker镜像
     *
     * @param dockerImagesStoryCommand 新增docker镜像     
     * @return {@link Result<DockerImages>} docker镜像新增后领域对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @Operation(summary = "新增docker镜像")
    @PostMapping("/story")
    public Result<DockerImages> story(@RequestBody DockerImagesStoryCommand dockerImagesStoryCommand){
        return dockerImagesApplication.story(dockerImagesStoryCommand);
    }
    /**
     * describe 批量新增docker镜像
     *
     * @param dockerImagesStoryCommandList 批量新增docker镜像     
     * @return {@link Result<List<DockerImages>>} docker镜像新增后领域对象集合     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @Operation(summary = "批量新增docker镜像")
    @PostMapping("/batchStory")
    public Result<List<DockerImages>> batchStory(@RequestBody List<DockerImagesStoryCommand> dockerImagesStoryCommandList){
        return dockerImagesApplication.batchStory(dockerImagesStoryCommandList);
    }
    /**
     * describe 更新docker镜像
     *
     * @param dockerImagesUpdateCommand 更新docker镜像     
     * @return {@link Result<DockerImages>} docker镜像领域对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @Operation(summary = "更新docker镜像")
    @PutMapping("/updateOne")
    public Result<DockerImages> updateOne(@RequestBody DockerImagesUpdateCommand dockerImagesUpdateCommand){
        return dockerImagesApplication.updateOne(dockerImagesUpdateCommand);
    }
    /**
     * describe 查询单个docker镜像
     *
     * @param dockerImagesQueryOneCommand 查询单个docker镜像     
     * @return {@link Result<DockerImagesDTO>} docker镜像DTO对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @Operation(summary = "查询单个docker镜像")
    @GetMapping("/findOne")
    public Result<DockerImagesDTO> findOne(@ModelAttribute DockerImagesQueryOneCommand dockerImagesQueryOneCommand){
        return dockerImagesApplication.findOne(dockerImagesQueryOneCommand);
    }
    /**
     * describe 查询多个docker镜像
     *
     * @param dockerImagesQueryListCommand 查询多个docker镜像     
     * @return {@link Result<List<DockerImagesDTO>>} docker镜像DTO对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @Operation(summary = "查询多个docker镜像")
    @GetMapping("/findList")
    public Result<List<DockerImagesDTO>> findList(@ModelAttribute DockerImagesQueryListCommand dockerImagesQueryListCommand){
        return dockerImagesApplication.findList(dockerImagesQueryListCommand);
    }
    /**
     * describe 分页查询多个docker镜像
     *
     * @param dockerImagesQueryListCommand 分页查询多个docker镜像     
     * @return {@link Result<LazyPage<DockerImagesDTO>>} 分页docker镜像DTO对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @Operation(summary = "分页查询多个docker镜像")
    @GetMapping("/findPage")
    public Result<LazyPage<DockerImagesDTO>> findPage(@Parameter(description ="分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                           @Parameter(description ="当前页数") @RequestParam(defaultValue = "1", value = "current") int current,@ModelAttribute DockerImagesQueryListCommand dockerImagesQueryListCommand){
        return dockerImagesApplication.findPage(size,current,dockerImagesQueryListCommand);
    }
    /**
     * describe 删除docker镜像
     *
     * @param dockerImagesRemoveCommand 删除docker镜像     
     * @return {@link Result<DockerImages>} docker镜像     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @Operation(summary = "删除docker镜像")
    @DeleteMapping("/remove")
    public Result<DockerImages> remove(@ModelAttribute DockerImagesRemoveCommand dockerImagesRemoveCommand){
        return dockerImagesApplication.remove(dockerImagesRemoveCommand);
    }
    /**
     * describe 导出docker镜像
     *
     * @param dockerImagesQueryListCommand 导出docker镜像     
     * @return {@link List<DockerImagesExcelExport>} docker镜像     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @EasyExcel(fileName = "导出docker镜像数据")
    @Operation(summary = "导出docker镜像")
    @GetMapping("/exportExcel")
    public List<DockerImagesExcelExport> exportExcel(@ModelAttribute DockerImagesQueryListCommand dockerImagesQueryListCommand){
        return dockerImagesApplication.exportExcel(dockerImagesQueryListCommand);
    }
    /**
     * describe 导出模版docker镜像
     *
     
     * @return {@link Result<List<DockerImagesExcelExport>>} docker镜像     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @EasyExcel(fileName = "导出docker镜像模版数据")
    @Operation(summary = "导出docker镜像模版")
    @GetMapping("/exportTemplateExcel")
    public List<DockerImagesExcelExport> exportTemplateExcel(){
        return List.of(new DockerImagesExcelExport());
    }
    /**
     * describe 导入docker镜像
     *
     * @param dockerImagesExcelImportList 导入docker镜像     
     * @return {@link Result<DockerImagesExcelImport>} docker镜像     
     
     * @author Jia wei Wu
     * @date 2025/07/10 05:16 下午
     **/

    @Operation(summary = "导入docker镜像")
    @PostMapping("/importExcel")
    public Result<List<DockerImagesExcelImport>> importExcel(@RequestExcelBody("multipartFile") List<DockerImagesExcelImport> dockerImagesExcelImportList){
        return dockerImagesApplication.importExcel(dockerImagesExcelImportList);
    }
}